<template>
	<view class="header_top">
		<u-icon @click="ToBack" name="arrow-left" style="opacity: 1;" color="#010101" size="45"></u-icon>
		<view class="header_top_title">
			{{title}}
		</view>
		<u-icon name="arrow-left" style="opacity: 0;" color="#010101" size="45"></u-icon>
	</view>
</template>
<script>
	import back from '@/componts/back.vue';
	export default {
		components:{
			back
		},
		props: {
			title:{
				type: String,
				default: ''
			},
			
		},
		data() {
			return {}
		},
		onLoad(e) {},
		onShow() {},
		methods: {
			ToBack(){
				console.log(11111111111)
				var pages = getCurrentPages();
				var currentPage = pages[pages.length - 1];
				if (pages.length > 1) {
					uni.navigateBack({
						delta: 1,
						success: () => console.log('返回成功'),
						fail: err => console.error('返回失败:', err)
					});
				} else {
					uni.switchTab({
						url: '/pages/index/index'
					});
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.header_top{
		display: flex;
		justify-content: space-between;
		top: 30rpx;
		left: 0rpx;
		width: 100vw;
		padding: 0 30rpx;
		position: fixed;
		z-index: 10000;
	}
	.header_top_title{
		flex:1;
		text-align: center;
		font-family: PingFang SC, PingFang SC;
		font-weight: bold;
		font-size: 32rpx;
		color: #030303;
		text-align: center;
		font-style: normal;
		text-transform: none;
	}
</style>